#ifndef __DOUBLELINKEDLIST_H_
#define __DOUBLELINKEDLIST_H_
#include <stdio.h>
#include <stdlib.h>
#define ERROR_CHECK(ret, num, msg) \
    {                              \
        if (ret == num)            \
        {                          \
            perror(msg);           \
            exit(1);               \
        }                          \
    }
// 头节点不存数据
typedef int type;
typedef struct node
{
    type data;
    struct node *Precursor_node;
    struct node *successor_node;
} ND;

// creat
ND *createList();

// insertNodeHead
void insertNodeHead(ND *head, int val);
// insertNodeTail
void insertNodeTail(ND *head, int val);
// showList
void showList(ND *head);
// select by val
ND *selectVal(ND *head, int val);

// changge val  (all)
void changeVal(ND *head, int srcVal, int destVal);
//del
void delVal(ND *head,int val);
// List length
int listLen(ND *head);
// is empty  0：空
int isEmpty(ND* head);
// init
void initList0(ND * head);
void initList1(ND * head);
// freeList
void freeList(ND **head);
#endif
